<?php
require 'user.php';
require 'function.php';
header("Content-Type: text/html; charset=UTF-8");
?>
<?php
echo <<<HTML
<html>
<head>
<title>文件管理</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}
.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文件管理器</div></div>
HTML;
?>
<?php
if($_GET['path']==null) {
$f=_opendir('..');
} else {
$f=_opendir(_decode($_GET['path']));
}
if($_GET['path']!=null) {
echo $path=realpath(_decode($_GET['path'])),'<br/>';
} else {
echo $path=realpath('..');
$_GET['path']=_encode('..');
}
if($f==false) {
echo "打开目录出错";

} else {
echo <<<HTML
<div class="big_board"><div class="board_title">当前目录</div></div>
<form action="system.php" method="post">
<a href="status.php?path=$_GET[path]&amp;onlyshow=1">SVN历史</a>
<select name="type">
<option value="status">SVN状态</option>
<option value="commit">SVN提交</option>
<option value="update">SVN更新</option>
<option value="log">更新日志</option>
<option value="cleanup">SVN清理</option>
<option value="branch">创建分支</option>
<option value="switch">信息更改</option>
<option value="resolve">解决冲突</option>
<option value="checkout">SVN检出</option>
<option value="upload">本地上传</option>
<option value="urlupload">远程上传</option>
<option value="mkfile">新建文件</opton>
<option value="mkdir">新建目录</option>
</select>
HTML;
echo '<input type="hidden" name="path" value="'._encode($f['.']).'"/>';
echo <<<HTML
<input type="submit" value="Go"/>
</form>
HTML;
if($f['..']!=null) {
$f['..']=dirname(realpath(_decode($_GET['path'])));
echo '<div class="big_board"><div class="board_title"></div></div>';
echo "-&gt;<a href=\"{$_SERVER['PHP_SELF']}?path="._encode(svnpath($f['..'],false))."\">上级目录</a><br/>";
}
if((count($f['dir'])+count($f['file'])+count($f['other']))>=1) {
echo '<form action="system.php?path='._encode($f['.']).'" method="post">';
echo <<<HTML
<select name="type">
<option value="proplist">SVN属性</option>
<option value="add">添加到SVN</option>
<option value="diff">比较文件</option>
<option value="revert_tip">撤销更改</option>
<option value="delete">删除文件</option>
<option value="pkzip">压缩文件</option>
<option value="move">移动/复制</option>
<option value="rename">重命名/复制</option></select>
<input type="submit" value="Go"/>
HTML;
if(count($f['dir'])>0){
echo <<<HTML
<div class="big_board"><div class="board_title">目录列表</div></div>
HTML;
natcasesort($f['dir']);
foreach($f['dir'] as $dir) {
echo '<input type="checkbox" name="selected[]" value="'._encode($dir).'"/><a href="'.$_SERVER['PHP_SELF'].'?path='._encode($dir).'">'.basename($dir).'</a><br/>';
}
}
if(count($f['file'])>=1) {
echo <<<HTML
<div class="big_board"><div class="board_title">文件列表</div></div>
HTML;
natcasesort($f['file']);
foreach($f['file'] as $file) {
echo '<input type="checkbox" name="selected[]" value="'._encode($file).'"/><a href="download.php/'.strtolower(urlencode($basename=basename($file))).'?path=',$cod=_encode($file),'">'.$basename.'</a><br/><a href="openfile.php?path='.$cod.'">编辑</a>.<a href="view.php?path='.$cod.'">查看</a>';
if(_extname($file)==='zip')
 echo '.<a href="unpkzip.php?path=',$cod,'">解压</a>';
echo '('._filesize($file).')<div class="big_board"><div class="board_title"></div></div>';
}
}
echo <<<HTML
</form>
HTML;
} else {
echo "空目录";
echo <<<HTML
<br/>
<select>
<option>无法操作(提示)</option>
</select>
<input type="submit" value="[Go]"/>
HTML;
}
}
?>
<?php
echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
</body>
</html>
HTML;
?>